<?php

class scanController {
	
	function __construct() {
	}
	
	public function render( $data ) {
		header("Expires: Wed, 19 Nov 2008 19:19:19 GMT");
		header("Cache-Control: no-store, no-cache, must-revalidate");
//		header("Content-Type: text/html; charset=utf-8");
		header('Content-Type: image/jpeg');
		
		if( $data ) {
			readfile($data);
		}
	}
	
	public function index() {		
		session_start();		
		$model = new scan;
		$data = $model->download();
		$this->render($data);
	}
	
	public function upload() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new scan;
		$data = $model->upload();
		echo json_encode( $data );
	}
	
	public function delete() {		
		if( !Tools::isAjax() ) return;
		session_start();
		$model = new scan;
		$data = $model->delete();
		echo json_encode( $data );
	}
	
}
?>